From: Caolán McNamara Date: Sun, 12 Jul 2026 13:46:11 +0000 (+0000) Subject: [PATCH] firebird: only write back an embedded database that was opened X-Git-Tag: archive/raspbian/4%25.2.3-2+rpi1+deb13u8^2~6 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/%22/%22http:/www.example.com/cgi/%22?a=commitdiff_plain;h=3073b58380b8977b35831c99db722efa0d5b37f4;p=libreoffice.git [PATCH] firebird: only write back an embedded database that was opened When construct throws before the attach succeeds, the connection is disposed with the temporary .fdb extracted but never opened, but storeDatabase ran the backup service against it anyway. Note whether the database was opened and skip the write back when it was not. Change-Id: I7c1bfdd880699d661e4b798fff441a357c141f12 Signed-off-by: Caolán McNamara Reviewed-on: https://gerrit.collaboraoffice.com/c/core/+/6703 Tested-by: Jenkins CPCI Reviewed-by: Miklos Vajna (cherry picked from commit a73db8b145af1c74cb181e094c0b7ccc4d92d8f0) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/208041 Tested-by: Jenkins Reviewed-by: Xisco Fauli Signed-off-by: Xisco Fauli Reviewed-on: https://gerrit.libreoffice.org/c/core/+/208065 Signed-off-by: Xisco Fauli Reviewed-on: https://gerrit.libreoffice.org/c/core/+/208077 Signed-off-by: Xisco Fauli Reviewed-on: https://gerrit.libreoffice.org/c/core/+/208113 Reviewed-by: Ilmari Lauhakangas Reviewed-by: Hossein Tested-by: Ilmari Lauhakangas Gbp-Pq: Name CVE-2026-63266-4.diff --- diff --git a/connectivity/source/drivers/firebird/Connection.cxx b/connectivity/source/drivers/firebird/Connection.cxx index 9ab978726d9..9b620d05adf 100644 --- a/connectivity/source/drivers/firebird/Connection.cxx +++ b/connectivity/source/drivers/firebird/Connection.cxx @@ -82,6 +82,7 @@ Connection::Connection() : Connection_BASE(m_aMutex) , m_bIsEmbedded(false) , m_bIsFile(false) + , m_bBackupDataOnDispose(false) , m_bIsAutoCommit(true) , m_bIsReadOnly(false) , m_aTransactionIsolation(TransactionIsolation::READ_COMMITTED) @@ -315,6 +316,10 @@ void Connection::construct(const OUString& url, const Sequence< PropertyValue >& if (m_bIsEmbedded) // Add DocumentEventListener to save the .fdb as needed { + // The database opened without error, so its temporary .fdb is + // worth writing back into the .odb on dispose. + m_bBackupDataOnDispose = true; + // We need to attach as a document listener in order to be able to store // the temporary db back into the .odb when saving uno::Reference xBroadcaster(m_xParentDocument, UNO_QUERY); @@ -907,7 +912,7 @@ void Connection::disposing() void Connection::storeDatabase() { MutexGuard aGuard(m_aMutex); - if (m_bIsEmbedded && m_xEmbeddedStorage.is()) + if (m_bIsEmbedded && m_bBackupDataOnDispose && m_xEmbeddedStorage.is()) { SAL_INFO("connectivity.firebird", "Writing .fbk from running db"); try diff --git a/connectivity/source/drivers/firebird/Connection.hxx b/connectivity/source/drivers/firebird/Connection.hxx index fb142283c72..c680c20db73 100644 --- a/connectivity/source/drivers/firebird/Connection.hxx +++ b/connectivity/source/drivers/firebird/Connection.hxx @@ -128,6 +128,11 @@ namespace connectivity::firebird /** We are using an external (local) file */ bool m_bIsFile; + /** When true the embedded database was opened in this session, so the + temporary .fdb holds live data that must be written back into the .odb + when the connection is disposed. */ + bool m_bBackupDataOnDispose; + /* CONNECTION PROPERTIES */ bool m_bIsAutoCommit; bool m_bIsReadOnly;